package BehavioralPattern.Interpreter;

import java.util.Map;

/**
 * @Classname : VarExpression
 * @Description : 运算元素（终结符号）解析器
 * @Author : chentianyu
 * @Date 2023/3/10 06:36
 */


public class VarExpression extends Expression {

    private String key;

    public VarExpression(String key) {
        this.key = key;
    }

    @Override
    public int interpret(Map<String, Integer> var) {
        return var.get(this.key);
    }
}
